import { defHttp } from '@/utils/http/axios';

enum Api {
  // 分类页面
  GetAllCategory = '/admin/cms/category/getAllCategory', //获取所有分类
  AddCategory = '/admin/cms/category/add', //新增分类
  DeleteCategory = '/admin/cms/category/delete', //删除分类
  UpdateCategory = '/admin/cms/category/update', //编辑分类
  // 图片上传页面
  AddImage = '/admin/cms/system/image/add', //新增图片
  DeleteByCategoryId = '/admin/cms/system/image/deleteByCategoryId', //删除分类下的图片
  DeleteById = '/admin/cms/system/image/deleteById', //根据图片ID删除图片
  GetCategoryId = '/admin/cms/system/image/getCategoryId', //根据分类Id查看图片
  UpdateImageInfo = '/admin/cms/system/image/update/name', //编辑图片信息
  UpdateImageCategory = '/admin/cms/system/image/updateCategory', //批量修改图片的分类
}

export function getAllCategory() {
  return defHttp.post({ url: Api.GetAllCategory });
}
export function addCategory(params) {
  return defHttp.post({ url: Api.AddCategory, params });
}
export function deleteCategory(params) {
  return defHttp.post({ url: Api.DeleteCategory, params });
}
export function updateCategory(params) {
  return defHttp.post({ url: Api.UpdateCategory, params });
}

export function addImage(params) {
  return defHttp.post({ url: Api.AddImage, params });
}
export function deleteByCategoryId(params) {
  return defHttp.post({ url: Api.DeleteByCategoryId, params });
}
export function deleteById(params) {
  return defHttp.post({ url: Api.DeleteById, params });
}
export function getCategoryId(params) {
  return defHttp.post({ url: Api.GetCategoryId, params });
}
export function updateImageInfo(params) {
  return defHttp.post({ url: Api.UpdateImageInfo, params });
}
export function updateImageCategory(params) {
  return defHttp.post({ url: Api.UpdateImageCategory, params });
}
